package com.zian.domain.dto;

import com.zian.enums.GenderEnum;
import com.zian.validation.ValidGroup;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

@Data
@ApiModel("修改管理员信息")
public class UpdateAdminDTO {

    @ApiModelProperty("管理员id")
    @NotNull(message = "id不能为空", groups = {ValidGroup.Crud.Update.class})
    @Null(message = "id必须为空", groups = {ValidGroup.Crud.Create.class})
    private Long id;

    @ApiModelProperty("用户名")
    @NotBlank(message = "用户名不能为空", groups = {ValidGroup.Crud.Create.class})
    @Length(min = 4, max = 10, message = "用户名长度在2-10位", groups = {ValidGroup.Crud.Create.class})
    private String username;

    @ApiModelProperty("管理员登陆密码")
    @NotBlank(message = "密码不能为空", groups = {ValidGroup.Crud.Create.class})
    @Length(min = 6, max = 20, message = "密码长度在6-20位", groups = {ValidGroup.Crud.Create.class})
    private String password;

    @ApiModelProperty("管理员显示昵称")
    @NotBlank(message = "昵称不能为空")
    @Length(min = 2, max = 10, message = "昵称长度在2-10位")
    private String nickName;

    @ApiModelProperty("性别 1 男 2女")
    @NotNull(message = "性别不能为空")
    private GenderEnum gender;

    @ApiModelProperty("手机号码")
    @NotBlank(message = "手机号码不能为空")
    private String phone;

    @ApiModelProperty("头像")
    @URL
    @NotBlank(message = "头像地址不能为空")
    private String avatar;
}
